IF exists(SELECT * FROM dbo.sysobjects WHERE name='vakrapportTrim' AND xtype='FN') 
BEGIN
	DROP FUNCTION vakrapportTrim
END
GO

create function vakrapportTrim
(@string varchar(8000))
returns varchar(8000)
as
begin
select @string = replace(replace(@string,char(10),' '),char(13),'')
select @string = ltrim(rtrim(@string))
return @string
end